#!/usr/bin/env perl

use utf8;
use strict;

sub total{
	my $sum;
	foreach(@_){
		$sum += $_;
	}
	return $sum;
}

my @fred = qw {1 3 5 7 9};

my $fred_sum = &total(@fred);

print "The total of \@fred is $fred_sum.\n";

print "Enter some numbers on separate lines:";

my $user_total = &total(<STDIN>);

print "The total of those number is $user_total.\n";
